package com.boot.rocketmq.consumer;


import com.boot.rocketmq.message.DemoTopicMessage;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

/**
 * @author lkz
 * @ClassName: Demo02Consumer
 * @description: 批量消费者
 * @date 2022/5/31 11:23
 */
@Component
@RocketMQMessageListener(topic = DemoTopicMessage.TOPIC_02,
        consumerGroup = "demo02-consumer-group-"+ DemoTopicMessage.TOPIC_02)
public class Demo02Consumer implements RocketMQListener<DemoTopicMessage> {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Override
    public void onMessage(DemoTopicMessage message) {
        logger.info("批量消费消息[onMessage][线程编号:{} 消息内容：{}]", Thread.currentThread().getId(), message);
    }

}
